// Player class for managing player data
export class Player {
  constructor(user_id = '', nickname = '', profile = '') {
    this._user_id = user_id
    this._nickname = nickname
    this._profile = profile
  }

  // Getters
  get user_id() {
    return this._user_id
  }

  get nickname() {
    return this._nickname
  }

  get profile() {
    return this._profile
  }

  // Setters
  set user_id(value) {
    this._user_id = String(value || '')
  }

  set nickname(value) {
    this._nickname = String(value || '')
  }

  set profile(value) {
    this._profile = String(value || '')
  }

  // Methods to update multiple properties
  updatePlayer(user_id, nickname, profile) {
    this.user_id = user_id
    this.nickname = nickname
    this.profile = profile
  }

  // Reset all properties
  reset() {
    this._user_id = ''
    this._nickname = ''
    this._profile = ''
  }

  // Get all data as object
  toObject() {
    return {
      user_id: this._user_id,
      nickname: this._nickname,
      profile: this._profile
    }
  }

  // Create from object
  static fromObject(obj) {
    return new Player(obj.user_id, obj.nickname, obj.profile)
  }
}
